package com.resrun.model;

import com.resrun.vo.request.CAKeysRequest;
import lombok.Data;

import java.util.Date;

/**
 * 证书记录信息
 *
 * @author hupan
 * @since 2024-01-23
 */
@Data
public class CAKeys {

    /**
     * 主键ID
     */
    private Long id;

    /**
     * 证书申请记录ID
     */
    private Long requestId;

    /**
     * 私钥
     */
    private byte[] privateKeyEncode;

    /**
     * 公钥
     */
    private byte[] publicKeyEncode;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;


    public static CAKeys of(CAKeysRequest request) {
        CAKeys caKeys = new CAKeys();
        caKeys.setRequestId(request.getRequestId());
        caKeys.setPrivateKeyEncode(request.getPrivateKeyEncode());
        caKeys.setPublicKeyEncode(request.getPublicKeyEncode());

        return caKeys;
    }

}
